#include "junix.h"
using namespace std;

class A
{
	public:
		A(int i, int j, int k)
			:a(i),b(j),c(k)
		{ }

		void g()
		{
			cout<<"A::g()"<<endl;
		}

		virtual void k()
		{
			cout<<"virtual void A::k()"<<endl;
		}

	public:
		int a;
	protected:
		int b;
	private:
		int c;
};

class B
:public A
{
	public:
		B(int i, int j,int k)
			:A(i,j,k), a(100)
		{ }

		int a;

		void f()
		{
			cout<<a<<endl;
			cout<<A::a<<endl;
			cout<<b<<endl;
		}


		void g()
		{
			cout<<"B::g()"<<endl;
			A::g();
		}


		/*
		virtual void k()
		{
			cout<<"virtual void B::k()"<<endl;
		}
		*/


		void k(int l=0)
		{
			cout<<"void k(int l)"<<endl;
		}
};

int main(int argc, char **argv)
{
	B b(1,2,3);
	b.f();
	b.g();
	b.k();
	b.k(9);

	A a(1,2,3);

	A& c=a;
	A& d=b;
	c.k();
	d.k();

}
